package com.jomoo.scs.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import com.jomoo.scs.mapper.UseraddressMapper;
import com.jomoo.scs.model.Useraddress;
import com.jomoo.scs.model.UseraddressExample;
import com.jomoo.scs.service.UseraddressService;
import com.jomoo.scs.utils.RedisUtils;
@Service
public class UseraddressServiceImpl implements UseraddressService {

	@Autowired
	private UseraddressMapper useraddressMapper;
	
	@Autowired
	private RedisUtils redisUtils;
	


	@Override
	public List<Useraddress> getAddress() {
		@SuppressWarnings("unchecked")
		List<Useraddress> object = (List<Useraddress>) redisUtils.get("list");
		if(object!=null){
			return object;
		}
		 List<Useraddress> list = useraddressMapper.selectByExample(new UseraddressExample());
		 redisUtils.set("list", list);
		return list;
		 
	}
	
	
	
}
